<template>
      <div id="VideoPlay">
            <video :src="videoUrl" currentTime="currentTime" @timeupdate="timeupdate" controls="controls">
            </video>
      </div>
</template>

<script>
import md5 from 'js-md5';
export default {
      name: "VideoPlay",
      data() {
            return {
                  videoUrl: "",
                  videoName:"",
                  currentTime: 0
            }
      },
      methods: {
            timeupdate() {
                  console.log("123123123123123")
                  localStorage.setItem(this.videoName, this.currentTime)
            }
      },
      created() {
            this.videoUrl = JSON.parse(localStorage.getItem("currentUrl")).url
            this.videoName = md5(this.videoUrl)
            if (localStorage.getItem(this.videoName)) {
                  this.currentTime = localStorage.getItem(this.videoName)
            }
      }
}
</script>

<style scoped>

</style>